<?php if (!AuthUser::hasPermission('administrator,developer,editor')) { header('Location: '.URL_PUBLIC.' '); exit(); } ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title><?php use_helper('Kses'); echo kses(Setting::get('admin_title'), array()) . ' - ' . ucfirst($ctrl = Dispatcher::getController(Setting::get('default_tab'))); ?></title>
    
    <base href="<?php echo trim(BASE_URL, '?/').'/'; ?>" />

    <link rel="favourites icon" href="<?php echo URL_PUBLIC; ?>favicon.ico" />
    <link href="stylesheets/admin.css" media="screen" rel="Stylesheet" type="text/css" />
    <link href="stylesheets/toolbar.css" media="screen" rel="Stylesheet" type="text/css" />
    <link href="themes/<?php echo Setting::get('theme'); ?>/styles.css" id="css_theme" media="screen" rel="Stylesheet" type="text/css" />

    <!-- IE6 PNG support fix -->
    <!--[if lt IE 7]>
        <script type="text/javascript" charset="utf-8" src="javascripts/unitpngfix.js"></script>
    <![endif]-->
    <script type="text/javascript" charset="utf-8" src="javascripts/prototype.js"></script>
    <script type="text/javascript" charset="utf-8" src="javascripts/effects.js"></script>
    <script type="text/javascript" charset="utf-8" src="javascripts/dragdrop.js"></script>
    <script type="text/javascript" charset="utf-8" src="javascripts/cp-datepicker.js"></script>
    <script type="text/javascript" charset="utf-8" src="javascripts/frog.js"></script>
    <script type="text/javascript" charset="utf-8" src="javascripts/control.textarea.js"></script>
    
<?php foreach(Plugin::$plugins as $plugin_id => $plugin): ?>
<?php if (file_exists(CORE_ROOT . '/plugins/' . $plugin_id . '/' . $plugin_id . '.js')): ?>
    <script type="text/javascript" charset="utf-8" src="../frog/plugins/<?php echo $plugin_id.'/'.$plugin_id; ?>.js"></script>
<?php endif; ?>
<?php if (file_exists(CORE_ROOT . '/plugins/' . $plugin_id . '/' . $plugin_id . '.css')): ?>
    <link href="../frog/plugins/<?php echo $plugin_id.'/'.$plugin_id; ?>.css" media="screen" rel="Stylesheet" type="text/css" />
<?php endif; ?>
<?php endforeach; ?>
<?php foreach(Plugin::$javascripts as $jscript_plugin_id => $javascript): ?>
    <script type="text/javascript" charset="utf-8" src="../frog/plugins/<?php echo $javascript; ?>"></script>
<?php endforeach; ?>
<?php foreach(Plugin::$stylesheets as $css_plugin_id => $css): ?>
    <link href="../frog/plugins/<?php echo $css; ?>" media="screen" rel="Stylesheet" type="text/css" />
<?php endforeach; ?>

<?php $action = Dispatcher::getAction(); ?>
  </head>
  <body id="body_<?php echo $ctrl.'_'.Dispatcher::getAction(); ?>" onload="if (window.parent.iframe_onload) window.parent.iframe_onload()" style="background-color: #fff">
    	<div id="header" style="background-color:#fff"></div>    	
      	<div id="content">
<?php if (Flash::get('error') !== null): ?>
      	  <div id="error" style="display: none"><?php echo Flash::get('error'); ?></div>
     		   <script type="text/javascript" language="javascript">
        // <![CDATA[
            Effect.Appear('error', {duration:.5});
        // ]]>
        		</script>
<?php endif; ?>
<?php if (Flash::get('success') !== null): ?>
        		<div id="success" style="display: none"><?php echo Flash::get('success'); ?></div>
       		<script type="text/javascript" language="javascript">
        // <![CDATA[
            Effect.Appear('success', {duration:.5});
        // ]]>
        		</script>

<?php endif; ?>

        <!-- content -->
        <?php echo $content_for_layout; ?>
        <!-- end content -->

      </div>
      <div id="sidebar-light-wrapper">
		   <div id="sidebar-light">
		       <!-- sidebar -->
		       <?php echo isset($sidebar) ? $sidebar: '&nbsp;'; ?>
		       <!-- end sidebar -->
		   </div>
		</div>
  </body>
</html>
